local skel = fk.CreateSkill {
  name = "emo__tongchou",
  tags = {Skill.Compulsory},
}

skel:addEffect(fk.Damage, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and target and target ~= player and not target.dead and target.kingdom == player.kingdom then
      local first = player.room.logic:getActualDamageEvents(1, function (e)
        return e.data.from == target
      end, Player.HistoryTurn)[1]
      return first and data == first.data
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if data.to ~= player then
      player:broadcastSkillInvoke(skel.name, 1)
      room:notifySkillInvoked(player, skel.name, "drawcard")
      player:drawCards(1, skel.name)
    else
      player:broadcastSkillInvoke(skel.name, 2)
      room:notifySkillInvoked(player, skel.name, "defensive")
      room:doIndicate(player, {target})
      room:loseHp(target, 1, skel.name)
    end
  end,
})

Fk:loadTranslationTable{
  ["emo__tongchou"] = "同仇",
  [":emo__tongchou"] = "锁定技，与你同势力的其他角色每回合首次造成伤害后，若受伤角色不为你，你摸一张牌，若为你，该角色失去1点体力。",
}

return skel
